namespace xConnected.Data.Migrations
{
    using System.Data.Entity.Migrations;
    
    public partial class EntryPoint : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "Users",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Email = c.String(nullable: false, maxLength: 50),
                        Username = c.String(nullable: false, maxLength: 50),
                        Password = c.String(nullable: false, maxLength: 50),
                        ActivationKey = c.Guid(nullable: false),
                        IsActivated = c.Boolean(nullable: false),
                        AccountType = c.Short(nullable: false),
                        Created = c.DateTime(nullable: false),
                        Updated = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .Index(t => t.Email)
                .Index(t => t.Username); ;

            CreateTable(
                "Countries",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                    ShortName = c.String(nullable: false, maxLength: 3),
                    Description = c.String(nullable: false, maxLength: 100),
                    Key = c.String(),
                    Created = c.DateTime(nullable: false),
                    Updated = c.DateTime(nullable: false),
                })
                .PrimaryKey(t => t.Id)
                .Index(t => t.ShortName);

            CreateTable(
               "Industries",
               c => new
               {
                   Id = c.Int(nullable: false, identity: true),
                   Description = c.String(nullable: false, maxLength: 50),
                   Key = c.String(nullable: false, maxLength: 100),
                   Created = c.DateTime(nullable: false),
                   Updated = c.DateTime(nullable: false),
               })
               .PrimaryKey(t => t.Id);

            CreateTable(
                "Categories",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                    Description = c.String(nullable: false, maxLength: 50),
                    Key = c.String(nullable: false, maxLength: 100),
                    IndustryId = c.Int(nullable: false),
                    ParentCategoryId = c.Int(),
                    Created = c.DateTime(nullable: false),
                    Updated = c.DateTime(nullable: false),
                })
                .PrimaryKey(t => t.Id)
                .ForeignKey("Categories", t => t.ParentCategoryId)
                .ForeignKey("Industries", t => t.IndustryId, cascadeDelete: true)
                .Index(t => t.ParentCategoryId)
                .Index(t => t.IndustryId);

            CreateTable(
               "Technologies",
               c => new
               {
                   Id = c.Int(nullable: false, identity: true),
                   Name = c.String(nullable: false, maxLength: 50),
                   IndustryId = c.Int(nullable: false),
                   Created = c.DateTime(nullable: false),
                   Updated = c.DateTime(nullable: false),
               })
               .PrimaryKey(t => t.Id)
               .ForeignKey("Industries", t => t.IndustryId, cascadeDelete: true)
               .Index(t => t.IndustryId);
            
            CreateTable(
                "ExpertProfiles",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        IsDefault = c.Boolean(nullable: false),
                        Title = c.String(nullable: false, maxLength: 30),
                        Description = c.String(nullable: false, maxLength: 100),
                        Website = c.String(maxLength: 50),
                        Skype = c.String(maxLength: 50),
                        Facebook = c.String(maxLength: 50),
                        Twitter = c.String(maxLength: 50),
                        Linkedin = c.String(maxLength: 50),
                        HourRate = c.Double(nullable: false),
                        DailyRate = c.Double(nullable: false),
                        MonthlyRate = c.Double(nullable: false),
                        AnnualRate = c.Double(nullable: false),
                        CommentRate = c.String(maxLength: 100),
                        JobType = c.Short(nullable: false),
                        Experience = c.String(),
                        References = c.String(),
                        Other = c.String(maxLength: 1024),
                        AvailabilityStatus = c.Short(nullable: false),
                        Availability = c.String(maxLength: 100),
                        Photo = c.String(maxLength: 250),
                        Cv = c.String(maxLength: 250),
                        Location = c.String(maxLength: 100),
                        XLocation = c.Double(nullable: false),
                        YLocation = c.Double(nullable: false),
                        Email = c.String(maxLength: 50),
                        PhoneNumber = c.String(maxLength: 50),
                        UserId = c.Int(nullable: false),
                        IndustryId = c.Int(nullable: false),
                        CountryId = c.Int(nullable: false),
                        Created = c.DateTime(nullable: false),
                        Updated = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("Countries", t => t.CountryId, cascadeDelete: true)
                .ForeignKey("Industries", t => t.IndustryId, cascadeDelete: true)
                .ForeignKey("Users", t => t.UserId, cascadeDelete: true)
                .Index(t => t.CountryId)
                .Index(t => t.IndustryId)
                .Index(t => t.UserId)
                .Index(t => t.Title)
                .Index(t => t.Description)
                .Index(t => t.HourRate)
                .Index(t => t.DailyRate)
                .Index(t => t.MonthlyRate)
                .Index(t => t.AnnualRate)
                .Index(t => t.XLocation)
                .Index(t => t.YLocation);
            
            CreateTable(
                "CategorySkills",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Level = c.Short(nullable: false),
                        Experience = c.Short(nullable: false),
                        ExpertProfileId = c.Int(nullable: false),
                        CategoryId = c.Int(nullable: false),
                        Created = c.DateTime(nullable: false),
                        Updated = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("Categories", t => t.CategoryId, cascadeDelete: false)
                .ForeignKey("ExpertProfiles", t => t.ExpertProfileId, cascadeDelete: true)
                .Index(t => t.CategoryId)
                .Index(t => t.ExpertProfileId);

            CreateTable(
               "TechnologySkills",
               c => new
               {
                   Id = c.Int(nullable: false, identity: true),
                   Level = c.Short(nullable: false),
                   Experience = c.Short(nullable: false),
                   ExpertProfileId = c.Int(nullable: false),
                   TechnologyId = c.Int(nullable: false),
                   Created = c.DateTime(nullable: false),
                   Updated = c.DateTime(nullable: false),
               })
               .PrimaryKey(t => t.Id)
               .ForeignKey("Technologies", t => t.TechnologyId)
               .ForeignKey("ExpertProfiles", t => t.ExpertProfileId, cascadeDelete: true)
               .Index(t => t.TechnologyId)
               .Index(t => t.ExpertProfileId);

            CreateTable(
               "Educations",
               c => new
               {
                   Id = c.Int(nullable: false, identity: true),
                   Title = c.String(nullable: false, maxLength: 15),
                   Description = c.String(nullable: false, maxLength: 100),
                   Key = c.String(),
                   Created = c.DateTime(nullable: false),
                   Updated = c.DateTime(nullable: false),
               })
               .PrimaryKey(t => t.Id);

            CreateTable(
                "EducationSkills",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                    Program = c.String(nullable: false, maxLength: 100),
                    University = c.String(nullable: false, maxLength: 300),
                    BeginYear = c.Int(nullable: false),
                    EndYear = c.Int(nullable: false),
                    ExpertProfileId = c.Int(nullable: false),
                    EducationId = c.Int(nullable: false),
                    Created = c.DateTime(nullable: false),
                    Updated = c.DateTime(nullable: false),
                })
                .PrimaryKey(t => t.Id)
                .ForeignKey("Educations", t => t.EducationId, cascadeDelete: false)
                .ForeignKey("ExpertProfiles", t => t.ExpertProfileId, cascadeDelete: true)
                .Index(t => t.EducationId)
                .Index(t => t.ExpertProfileId)
                .Index(t => t.University)
                .Index(t => t.Program);

            CreateTable(
                "Languages",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                    ShortName = c.String(nullable: false, maxLength: 3),
                    Description = c.String(nullable: false, maxLength: 100),
                    Key = c.String(),
                    Created = c.DateTime(nullable: false),
                    Updated = c.DateTime(nullable: false),
                })
                .PrimaryKey(t => t.Id)
                .Index(t => t.ShortName); 

            CreateTable(
                "LanguageSkills",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                    Level = c.Short(nullable: false),
                    ExpertProfileId = c.Int(nullable: false),
                    LanguageId = c.Int(nullable: false),
                    Created = c.DateTime(nullable: false),
                    Updated = c.DateTime(nullable: false),
                })
                .PrimaryKey(t => t.Id)
                .ForeignKey("Languages", t => t.LanguageId, cascadeDelete: false)
                .ForeignKey("ExpertProfiles", t => t.ExpertProfileId, cascadeDelete: true)
                .Index(t => t.LanguageId)
                .Index(t => t.ExpertProfileId);

            CreateTable(
                "CompanyProfiles",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        IsDefault = c.Boolean(nullable: false),
                        Title = c.String(nullable: false, maxLength: 30),
                        TagLine = c.String(nullable: false, maxLength: 100),
                        Description = c.String(nullable: false),
                        Website = c.String(nullable: false, maxLength: 50),
                        Location = c.String(nullable: false, maxLength: 50),
                        XLocation = c.Double(nullable: false),
                        YLocation = c.Double(nullable: false),
                        Email = c.String(nullable: false, maxLength: 50),
                        PhoneNumber = c.String(nullable: false, maxLength: 50),
                        Photo = c.String(maxLength: 250),
                        UserId = c.Int(nullable: false),
                        IndustryId = c.Int(nullable: false),
                        CountryId = c.Int(nullable: false),
                        Created = c.DateTime(nullable: false),
                        Updated = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("Countries", t => t.CountryId, cascadeDelete: true)
                .ForeignKey("Industries", t => t.IndustryId, cascadeDelete: true)
                .ForeignKey("Users", t => t.UserId, cascadeDelete: true)
                .Index(t => t.CountryId)
                .Index(t => t.IndustryId)
                .Index(t => t.UserId)
                .Index(t => t.Title)
                .Index(t => t.TagLine)
                .Index(t => t.XLocation)
                .Index(t => t.YLocation);
            
            CreateTable(
                "Projects",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        IsDefault = c.Boolean(nullable: false),
                        Title = c.String(nullable: false, maxLength: 50),
                        Description = c.String(nullable: false),
                        StartDate = c.DateTime(nullable: false),
                        Duration = c.String(nullable: false),
                        Location = c.String(nullable: false),
                        XLocation = c.Double(nullable: false),
                        YLocation = c.Double(nullable: false),
                        Photo = c.String(maxLength: 250),
                        JobType = c.Short(nullable: false),
                        CompanyProfileId = c.Int(nullable: false),
                        IndustryId = c.Int(nullable: false),
                        CountryId = c.Int(nullable: false),
                        Created = c.DateTime(nullable: false),
                        Updated = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("Countries", t => t.CountryId, cascadeDelete: false)
                .ForeignKey("CompanyProfiles", t => t.CompanyProfileId, cascadeDelete: true)
                .ForeignKey("Industries", t => t.IndustryId, cascadeDelete: false)
                .Index(t => t.CountryId)
                .Index(t => t.CompanyProfileId)
                .Index(t => t.IndustryId)
                .Index(t => t.Title)
                .Index(t => t.StartDate)
                .Index(t => t.XLocation)
                .Index(t => t.YLocation);

            CreateTable(
                "Messages",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                    Subject = c.String(nullable: false, maxLength: 255),
                    Body = c.String(nullable: false),
                    AllRecipientsVisible = c.Boolean(nullable: false),
                    ParentId = c.Int(),
                    Created = c.DateTime(nullable: false),
                    Updated = c.DateTime(nullable: false),
                })
                .PrimaryKey(t => t.Id)
                .ForeignKey("Messages", t => t.ParentId)
                .Index(t => t.ParentId)
                .Index(t => t.Subject); 

            CreateTable(
                "MessageFolders",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                    Name = c.String(nullable: false, maxLength: 20),
                    FolderType = c.Short(nullable: false),
                    OwnerId = c.Int(nullable: false),
                    Created = c.DateTime(nullable: false),
                    Updated = c.DateTime(nullable: false),
                })
                .PrimaryKey(t => t.Id)
                .ForeignKey("Users", t => t.OwnerId, cascadeDelete: false)
                .Index(t => t.OwnerId);

            CreateTable(
               "MessageExpertUsers",
               c => new
               {
                   Id = c.Int(nullable: false, identity: true),
                   IsRead = c.Boolean(nullable: false),
                   IsStarred = c.Boolean(nullable: false),
                   IsSender = c.Boolean(nullable: false),
                   IsDeleted = c.Boolean(nullable: false),
                   MessageId = c.Int(nullable: false),
                   ExpertProfileId = c.Int(nullable: false),
                   MessageFolderId = c.Int(nullable: false),
                   Created = c.DateTime(nullable: false),
                   Updated = c.DateTime(nullable: false),
               })
               .PrimaryKey(t => t.Id)
               .ForeignKey("MessageFolders", t => t.MessageFolderId, cascadeDelete: true)
               .ForeignKey("Messages", t => t.MessageId, cascadeDelete: true)
               .ForeignKey("ExpertProfiles", t => t.ExpertProfileId, cascadeDelete: true)
               .Index(t => t.MessageFolderId)
               .Index(t => t.MessageId)
               .Index(t => t.ExpertProfileId);

            CreateTable(
               "MessageCompanyUsers",
               c => new
               {
                   Id = c.Int(nullable: false, identity: true),
                   IsRead = c.Boolean(nullable: false),
                   IsStarred = c.Boolean(nullable: false),
                   IsSender = c.Boolean(nullable: false),
                   IsDeleted = c.Boolean(nullable: false),
                   MessageId = c.Int(nullable: false),
                   CompanyProfileId = c.Int(nullable: false),
                   MessageFolderId = c.Int(nullable: false),
                   Created = c.DateTime(nullable: false),
                   Updated = c.DateTime(nullable: false),
               })
               .PrimaryKey(t => t.Id)
               .ForeignKey("MessageFolders", t => t.MessageFolderId, cascadeDelete: true)
               .ForeignKey("Messages", t => t.MessageId, cascadeDelete: true)
               .ForeignKey("CompanyProfiles", t => t.CompanyProfileId, cascadeDelete: true)
               .Index(t => t.MessageFolderId)
               .Index(t => t.MessageId)
               .Index(t => t.CompanyProfileId);
            
            CreateTable(
                "MessageProjectUsers",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        IsRead = c.Boolean(nullable: false),
                        IsStarred = c.Boolean(nullable: false),
                        IsSender = c.Boolean(nullable: false),
                        IsDeleted = c.Boolean(nullable: false),
                        MessageId = c.Int(nullable: false),
                        ProjectId = c.Int(nullable: false),
                        MessageFolderId = c.Int(nullable: false),
                        Created = c.DateTime(nullable: false),
                        Updated = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("MessageFolders", t => t.MessageFolderId, cascadeDelete: true)
                .ForeignKey("Messages", t => t.MessageId, cascadeDelete: true)
                .ForeignKey("Projects", t => t.ProjectId, cascadeDelete: true)
                .Index(t => t.MessageFolderId)
                .Index(t => t.MessageId)
                .Index(t => t.ProjectId);

            CreateTable(
              "ExpertLists",
              c => new
              {
                  Id = c.Int(nullable: false, identity: true),
                  Name = c.String(nullable: false),
                  IsBlackList = c.Boolean(nullable: false),
                  OwnerId = c.Int(nullable: false),
                  Created = c.DateTime(nullable: false),
                  Updated = c.DateTime(nullable: false),
              })
              .PrimaryKey(t => t.Id)
              .ForeignKey("Users", t => t.OwnerId, cascadeDelete: true)
              .Index(t => t.OwnerId);

            CreateTable(
               "CompanyLists",
               c => new
               {
                   Id = c.Int(nullable: false, identity: true),
                   Name = c.String(nullable: false),
                   IsBlackList = c.Boolean(nullable: false),
                   OwnerId = c.Int(nullable: false),
                   Created = c.DateTime(nullable: false),
                   Updated = c.DateTime(nullable: false),
               })
               .PrimaryKey(t => t.Id)
               .ForeignKey("Users", t => t.OwnerId, cascadeDelete: true)
               .Index(t => t.OwnerId);
          
            CreateTable(
                "ProjectLists",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false),
                        IsBlackList = c.Boolean(nullable: false),
                        OwnerId = c.Int(nullable: false),
                        Created = c.DateTime(nullable: false),
                        Updated = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.Id)
                .ForeignKey("Users", t => t.OwnerId, cascadeDelete: true)
                .Index(t => t.OwnerId);

            CreateTable(
               "CompanyProfileCategories",
               c => new
               {
                   CompanyProfileId = c.Int(nullable: false),
                   CategoryId = c.Int(nullable: false),
               })
               .PrimaryKey(t => new { t.CompanyProfileId, t.CategoryId })
               .ForeignKey("CompanyProfiles", t => t.CompanyProfileId, cascadeDelete: true)
               .ForeignKey("Categories", t => t.CategoryId, cascadeDelete: false)
               .Index(t => t.CompanyProfileId)
               .Index(t => t.CategoryId);

            CreateTable(
                "CompanyProfileTechnologies",
                c => new
                {
                    CompanyProfileId = c.Int(nullable: false),
                    TechnologyId = c.Int(nullable: false),
                })
                .PrimaryKey(t => new { t.CompanyProfileId, t.TechnologyId })
                .ForeignKey("CompanyProfiles", t => t.CompanyProfileId, cascadeDelete: true)
                .ForeignKey("Technologies", t => t.TechnologyId, cascadeDelete: false)
                .Index(t => t.CompanyProfileId)
                .Index(t => t.TechnologyId);
            
            CreateTable(
                "ProjectCategories",
                c => new
                    {
                        ProjectId = c.Int(nullable: false),
                        CategoryId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.ProjectId, t.CategoryId })
                .ForeignKey("Projects", t => t.ProjectId, cascadeDelete: true)
                .ForeignKey("Categories", t => t.CategoryId, cascadeDelete: false)
                .Index(t => t.ProjectId)
                .Index(t => t.CategoryId);
            
            CreateTable(
                "ProjectTechnologies",
                c => new
                    {
                        ProjectId = c.Int(nullable: false),
                        TechnologyId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.ProjectId, t.TechnologyId })
                .ForeignKey("Projects", t => t.ProjectId, cascadeDelete: true)
                .ForeignKey("Technologies", t => t.TechnologyId, cascadeDelete: false)
                .Index(t => t.ProjectId)
                .Index(t => t.TechnologyId);
            
            CreateTable(
                "ProjectListProjects",
                c => new
                    {
                        ProjectListId = c.Int(nullable: false),
                        ProjectId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.ProjectListId, t.ProjectId })
                .ForeignKey("ProjectLists", t => t.ProjectListId, cascadeDelete: true)
                .ForeignKey("Projects", t => t.ProjectId, cascadeDelete: false)
                .Index(t => t.ProjectListId)
                .Index(t => t.ProjectId);
            
            CreateTable(
                "CompanyListCompanyProfiles",
                c => new
                    {
                        CompanyListId = c.Int(nullable: false),
                        CompanyProfileId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.CompanyListId, t.CompanyProfileId })
                .ForeignKey("CompanyLists", t => t.CompanyListId, cascadeDelete: false)
                .ForeignKey("CompanyProfiles", t => t.CompanyProfileId, cascadeDelete: true)
                .Index(t => t.CompanyListId)
                .Index(t => t.CompanyProfileId);
            
            CreateTable(
                "ExpertListExpertProfiles",
                c => new
                    {
                        ExpertListId = c.Int(nullable: false),
                        ExpertProfileId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.ExpertListId, t.ExpertProfileId })
                .ForeignKey("ExpertLists", t => t.ExpertListId, cascadeDelete: false)
                .ForeignKey("ExpertProfiles", t => t.ExpertProfileId, cascadeDelete: true)
                .Index(t => t.ExpertListId)
                .Index(t => t.ExpertProfileId);

            CreateTable(
                "Log4Net_Error",
                c => new
                {
                    Id = c.Int(nullable: false, identity: true),
                    Date = c.DateTime(nullable: false),
                    Thread = c.String(nullable: false, maxLength: 255),
                    Level = c.String(nullable: false, maxLength: 50),
                    Logger = c.String(nullable: false, maxLength: 255),
                    Message = c.String(nullable: false, maxLength: 4000),
                    Exception = c.String(maxLength: 2000)
                })
                .PrimaryKey(t => t.Id);
            
        }
        
        public override void Down()
        {
            DropIndex("Users", "Email");
            DropIndex("Users", "Username");
            DropIndex("ExpertProfiles", "Title");
            DropIndex("ExpertProfiles", "Description");
            DropIndex("ExpertProfiles", "HourRate");
            DropIndex("ExpertProfiles", "DailyRate");
            DropIndex("ExpertProfiles", "MonthlyRate");
            DropIndex("ExpertProfiles", "AnnualRate");
            DropIndex("ExpertProfiles", "XLocation");
            DropIndex("ExpertProfiles", "YLocation");
            DropIndex("CompanyProfiles", "Title");
            DropIndex("CompanyProfiles", "TagLine");
            DropIndex("CompanyProfiles", "Description");
            DropIndex("CompanyProfiles", "XLocation");
            DropIndex("CompanyProfiles", "YLocation");
            DropIndex("Projects", "Title");
            DropIndex("Projects", "StartDate");
            DropIndex("Projects", "XLocation");
            DropIndex("Projects", "YLocation");
            DropIndex("EducationSkills", "Program");
            DropIndex("EducationSkills", "University");
            DropIndex("Countries", "ShortName");
            DropIndex("Languages", "ShortName");
            DropIndex("Messages", "Subject");
            DropIndex("CompanyProfileTechnologies", new[] { "TechnologyId" });
            DropIndex("CompanyProfileTechnologies", new[] { "CompanyProfileId" });
            DropIndex("CompanyProfileCategories", new[] { "CategoryId" });
            DropIndex("CompanyProfileCategories", new[] { "CompanyProfileId" });
            DropIndex("ProjectTechnologies", new[] { "TechnologyId" });
            DropIndex("ProjectTechnologies", new[] { "ProjectId" });
            DropIndex("ProjectCategories", new[] { "CategoryId" });
            DropIndex("ProjectCategories", new[] { "ProjectId" });
            DropIndex("LanguageSkills", new[] { "ExpertProfileId" });
            DropIndex("LanguageSkills", new[] { "LanguageId" });
            DropIndex("EducationSkills", new[] { "ExpertProfileId" });
            DropIndex("EducationSkills", new[] { "EducationId" });
            DropIndex("CompanyListCompanyProfiles", new[] { "CompanyProfileId" });
            DropIndex("CompanyListCompanyProfiles", new[] { "CompanyListId" });
            DropIndex("ExpertListExpertProfiles", new[] { "ExpertProfileId" });
            DropIndex("ExpertListExpertProfiles", new[] { "ExpertListId" });
            DropIndex("ProjectListProjects", new[] { "ProjectId" });
            DropIndex("ProjectListProjects", new[] { "ProjectListId" });
            DropIndex("MessageCompanyUsers", new[] { "CompanyProfileId" });
            DropIndex("MessageCompanyUsers", new[] { "MessageId" });
            DropIndex("MessageCompanyUsers", new[] { "MessageFolderId" });
            DropIndex("MessageFolders", new[] { "OwnerId" });
            DropIndex("MessageExpertUsers", new[] { "ExpertProfileId" });
            DropIndex("MessageExpertUsers", new[] { "MessageId" });
            DropIndex("MessageExpertUsers", new[] { "MessageFolderId" });
            DropIndex("Messages", new[] { "ParentId" });
            DropIndex("MessageProjectUsers", new[] { "ProjectId" });
            DropIndex("MessageProjectUsers", new[] { "MessageId" });
            DropIndex("MessageProjectUsers", new[] { "MessageFolderId" });
            DropIndex("TechnologySkills", new[] { "ExpertProfileId" });
            DropIndex("TechnologySkills", new[] { "TechnologyId" });
            DropIndex("Technologies", new[] { "IndustryId" });

            DropIndex("ProjectLists", new[] { "OwnerId" });
            DropIndex("CompanyLists", new[] { "OwnerId" });
            DropIndex("ExpertLists", new[] { "OwnerId" });

            DropIndex("Projects", new[] { "IndustryId" });
            DropIndex("Projects", new[] { "CompanyProfileId" });
            DropIndex("Projects", new[] { "CountryId" });
            DropIndex("CompanyProfiles", new[] { "UserId" });
            DropIndex("CompanyProfiles", new[] { "IndustryId" });
            DropIndex("CompanyProfiles", new[] { "CountryId" });
            DropIndex("CategorySkills", new[] { "ExpertProfileId" });
            DropIndex("CategorySkills", new[] { "CategoryId" });
            DropIndex("Categories", new[] { "IndustryId" });
            DropIndex("Categories", new[] { "ParentCategoryId" });
            DropIndex("ExpertProfiles", new[] { "UserId" });
            DropIndex("ExpertProfiles", new[] { "IndustryId" });
            DropIndex("ExpertProfiles", new[] { "CountryId" });
            
            


            DropForeignKey("ProjectTechnologies", "TechnologyId", "Technologies");
            DropForeignKey("ProjectTechnologies", "ProjectId", "Projects");
            DropForeignKey("ProjectCategories", "CategoryId", "Categories");
            DropForeignKey("ProjectCategories", "ProjectId", "Projects");
            DropForeignKey("CompanyProfileTechnologies", "TechnologyId", "Technologies");
            DropForeignKey("CompanyProfileTechnologies", "CompanyProfileId", "CompanyProfiles");
            DropForeignKey("CompanyProfileCategories", "CategoryId", "Categories");
            DropForeignKey("CompanyProfileCategories", "CompanyProfileId", "CompanyProfiles");
            DropForeignKey("MessageProjectUsers", "ProjectId", "Projects");
            DropForeignKey("MessageProjectUsers", "MessageId", "Messages");
            DropForeignKey("MessageProjectUsers", "MessageFolderId", "MessageFolders");
            DropForeignKey("MessageCompanyUsers", "CompanyProfileId", "CompanyProfiles");
            DropForeignKey("MessageCompanyUsers", "MessageId", "Messages");
            DropForeignKey("MessageCompanyUsers", "MessageFolderId", "MessageFolders");
            DropForeignKey("MessageExpertUsers", "ExpertProfileId", "ExpertProfiles");
            DropForeignKey("MessageExpertUsers", "MessageId", "Messages");
            DropForeignKey("MessageExpertUsers", "MessageFolderId", "MessageFolders");
            DropForeignKey("MessageFolders", "OwnerId", "Users");
            DropForeignKey("Messages", "ParentId", "Messages");

            DropForeignKey("ProjectListProjects", "ProjectId", "Projects");
            DropForeignKey("ProjectListProjects", "ProjectListId", "ProjectLists");
            DropForeignKey("CompanyListCompanyProfiles", "CompanyProfileId", "CompanyProfiles");
            DropForeignKey("CompanyListCompanyProfiles", "CompanyListId", "CompanyLists");
            DropForeignKey("ExpertListExpertProfiles", "ExpertProfileId", "ExpertProfiles");
            DropForeignKey("ExpertListExpertProfiles", "ExpertListId", "ExpertLists");
            DropForeignKey("ProjectLists", "OwnerId", "Users");
            DropForeignKey("CompanyLists", "OwnerId", "Users");
            DropForeignKey("ExpertLists", "OwnerId", "Users");

            DropForeignKey("Projects", "IndustryId", "Industries");
            DropForeignKey("Projects", "CompanyProfileId", "CompanyProfiles");
            DropForeignKey("Projects", "CountryId", "Countries");
            DropForeignKey("CompanyProfiles", "UserId", "Users");
            DropForeignKey("CompanyProfiles", "IndustryId", "Industries");
            DropForeignKey("CompanyProfiles", "CountryId", "Countries");
            DropForeignKey("LanguageSkills", "ExpertProfileId", "ExpertProfiles");
            DropForeignKey("LanguageSkills", "LanguageId", "Languages");
            DropForeignKey("EducationSkills", "ExpertProfileId", "ExpertProfiles");
            DropForeignKey("EducationSkills", "EducationId", "Educations");
            DropForeignKey("TechnologySkills", "ExpertProfileId", "ExpertProfiles");
            DropForeignKey("TechnologySkills", "TechnologyId", "Technologies");
            DropForeignKey("CategorySkills", "ExpertProfileId", "ExpertProfiles");
            DropForeignKey("CategorySkills", "CategoryId", "Categories");
            DropForeignKey("ExpertProfiles", "UserId", "Users");
            DropForeignKey("ExpertProfiles", "IndustryId", "Industries");
            DropForeignKey("ExpertProfiles", "CountryId", "Countries");
            DropForeignKey("Technologies", "IndustryId", "Industries");
            DropForeignKey("Categories", "IndustryId", "Industries");
            DropForeignKey("Categories", "ParentCategoryId", "Categories");
           
           


            DropTable("Log4Net_Error");
            DropTable("ProjectTechnologies");
            DropTable("ProjectCategories");
            DropTable("CompanyProfileTechnologies");
            DropTable("CompanyProfileCategories");
            DropTable("MessageProjectUsers");
            DropTable("MessageCompanyUsers");
            DropTable("MessageExpertUsers");
            DropTable("MessageFolders");
            DropTable("Messages");

            DropTable("ProjectLists");
            DropTable("CompanyLists");
            DropTable("ExpertLists");
            DropTable("ProjectListProjects");
            DropTable("CompanyListCompanyProfiles");
            DropTable("ExpertListExpertProfiles");

            DropTable("Projects");
            DropTable("CompanyProfiles");
            DropTable("LanguageSkills");
            DropTable("Languages");
            DropTable("EducationSkills");
            DropTable("Educations");
            DropTable("TechnologySkills");
            DropTable("CategorySkills");
            DropTable("ExpertProfiles");
            DropTable("Technologies");
            DropTable("Categories");
            DropTable("Industries");
            DropTable("Countries");
            DropTable("Users");

        }
    }
}
